package integration;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class PromotionDAOServer {
	
	private Registry annuaire;
	
	public static void main(String[] args) throws RemoteException
	{
		PromotionDAOServer serveur = new PromotionDAOServer();
		serveur.publish();
	}
	
	public PromotionDAOServer() throws RemoteException
	{
		annuaire = LocateRegistry.createRegistry(1099);
	}
	
	public void publish() throws RemoteException
	{
		//1.1
		PromotionDAO dao = new PromotionDAO();
		PromotionDAORemote service = new PromotionDAOImpl(dao);
		//1.2
		annuaire.rebind("rmi://localhost:1099/esiag/service",service);
		System.out.println("Service public");
	}
}

